package com.gnkexy.springframework.test;

import com.gnkexy.springframework.beans.BeansException;
import com.gnkexy.springframework.beans.factory.support.BeanFactory;
import com.gnkexy.springframework.context.ApplicationContext;
import com.gnkexy.springframework.context.supper.ClassPathXmlApplicationContext;
import com.gnkexy.springframework.test.bean.UserService;
import org.junit.Test;

public class ApiTest4 {

    @Test
    public void test_xml() throws BeansException {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring.xml");
        applicationContext.registerShutdownHook();

        UserService userService = (UserService) applicationContext.getBean("userService");
        String result = userService.queryUserInfo();
        BeanFactory beanFactory = userService.getBeanFactory();
        ApplicationContext applicationContext1 = userService.getApplicationContext();
        System.out.println(result);
        System.out.println(beanFactory);
        System.out.println(applicationContext1);
    }

}
